package org.hot100_6.leetcode226;

import org.leetcode.TreeNode;

public class Solution {
    public TreeNode invertTree(TreeNode root) {

        if (root==null){
            return root;
        }

        TreeNode temp = root.left;
        root.left = root.right;
        root.right = temp;

        invertTree(root.left);
        invertTree(root.right);

        return root;
    }

//    public void invert(TreeNode left,TreeNode right){
//
//        if (left==null && right==null){
//            return;
//        }
//
//        TreeNode temp = left;
//
//        left = right;
//        right = temp;
//
//        invert(left.left,left.right);
//        invert(right.left,right.right);
//    }
}
